<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8"/>
    <title>Destination Decision</title>
    <meta name="description" content="Destination Decision"/>
    <link rel="stylesheet" type="text/css" href="${ctx}/static/css/config.css"/>
</head>
<body>
<div class="config-block">
    <form action="${ctx}/dispatch" method="post">
        <div class="config-block">
            <div class="config-item">
                <span class="config-item-title">Select a interface</span>
                <select title="Interface Name" id="interface_name_list" name="interface_name_list" onchange="selectInterfaceName()">
                    <option value ="interface.sample">select interface name for test</option>
                    <c:forEach var="interface_name" items="${interface_list}">
                        <option value ="${interface_name}">${interface_name}</option>
                    </c:forEach>
                </select>
            </div>
            <input type="hidden" id="interface_name" name="interface_name"/>
            <input type="hidden" id="m" name="m" value="${m}"/>
            <div class="config-item">
                <span class="config-item-title">Submit</span>
                <button class="config-button" type="submit" id="submitBtn" name="submitBtn" disabled="disabled">Select first, then you can save the world &#128527;</button>
            </div>
        </div>
    </form>
</div>
<span style="clear:both; z-index:1000; overflow:hidden; bottom:10px; left:5px;position:fixed !important;color: #e9e9e9">Author: Charkey@ODC;Cooperator: 大头森@ODC</span>
<script type="application/javascript" src="${ctx}/static/jquery-2.0.3.min.js"></script>
<script type="application/javascript">
    var isFirstItemRemoved = false;
    function selectInterfaceName() {
        $("#interface_name").val($("#interface_name_list").find("option:selected").text());
        if(!isFirstItemRemoved) {
            $("#interface_name_list option[value='interface.sample']").remove();
            isFirstItemRemoved = true;
            $("#submitBtn").removeAttr("disabled");
        }
    }
</script>
</body>
</html>

